package com.bianmaba.controllers.datacollection;

import com.bianmaba.beans.datacollection.CollectionTask;
import com.bianmaba.commons.bean.result.QueryResult;
import com.bianmaba.commons.data.jpa.domain.request.PageableRequest;
import com.bianmaba.controllers.base.support.CrudControllerSwaggerSupport;
import com.bianmaba.services.datacollection.ICollectionTaskService;
import com.bianmaba.spring.mvc.annotation.RequestResponseBodyConfig;
import com.bianmaba.spring.mvc.config.annotation.EntityParam;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;
import java.util.List;

@Api(description = "采集任务API")
@RestController
@RequestMapping(value = "datacollection/collectiontask")
public class CollectionTaskController extends CrudControllerSwaggerSupport<CollectionTask, String> {
    @Autowired
    private ICollectionTaskService service;

    protected ICollectionTaskService getService() {
        return service;
    }

    @RequestResponseBodyConfig(excludeProperties = {"data.*\\.collectionInterface", "data.*\\.parameterMaps", "data.*\\.parameters"})
    @RequestMapping(value = {"/query_simple"}, method = RequestMethod.POST)
    public QueryResult<List<CollectionTask>> querySimple(@EntityParam LinkedHashMap<String, Object> params, @EntityParam PageableRequest pageable) {
        return super.query(params, pageable);
    }
}
